﻿using MainInterface;
using MainService;
using MainZNQD;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
namespace MainProGrid
{
    /// <summary>
    /// 自定义事件实体类
    /// </summary>
    public class CustomEvent
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="Component">依赖组件</param>
        /// <param name="PropertyType">属性类型</param>
        /// <param name="ChinaName">属性中文名称</param>
        /// <param name="Name">属性名</param>
        /// <param name="GroupName">属性分组</param>
        /// <param name="Description">属性描述</param>
        public CustomEvent(IProperType Component, Type PropertyType, string ChinaName, string Name, string Description,Dictionary<string,string> Args) 
        {
            this.Component = Component;
            this.PropertyType = PropertyType;
            this.ChinaName = ChinaName;
            this.Name = Name;
            this.Description = Description;
            this.Editor = new EventEditor(this);
            this.Args = Args;
        }
        #region 
        public bool ReadyOnly = false;
        public TypeConverter Converter { get; set; }
        public virtual object Editor { get; set; }
        public IProperType Component { get; set; }
        public Type PropertyType { get; set; }
        public string Name { get; set; }
        public string ChinaName { get; set; }
        public string Description { get; set; }
        public Dictionary<string,string> Args { get; set; }
        public List<string> ArgsDescription { get; set; }
        public object Value 
        {
            get
            {
               return Component.GetValue(this.Name);
            }
            set
            {
                Component.SetValue(this.Name, value);
            }
        }
        #endregion
    }
}
